Imports System.Windows.Forms

Partial Public Class WMSServerParameters
    Inherits Form

    Public Sub New()
        InitializeComponent()
        WmsServerInfo = New WmsServerInfo()
    End Sub

    Private Sub btnGetCapabilities_Click(sender As Object, e As EventArgs)
        Dim serverUrl = tbServerUrl.Text

        Dim wmsClient = New WMSClient()
        wmsClient.ReadCapabilities(serverUrl)
        WmsServerInfo.Version = wmsClient.Version
        WmsServerInfo.OnlineResource = wmsClient.ServiceDescription.OnlineResource

        Dim layers = wmsClient.GetVisibleLayer()
        dgvLayers.DataSource = layers
    End Sub

    Public Property WmsServerInfo() As WmsServerInfo

    Private Sub btnOK_Click(sender As Object, e As EventArgs)
        If dgvLayers.SelectedRows.Count > 0 Then
            WmsServerInfo.Layer = DirectCast(dgvLayers.SelectedRows(0).DataBoundItem, WMSClient.ServerLayer).Name
        End If
        DialogResult = DialogResult.OK
    End Sub
End Class

Public Class WmsServerInfo
    Public Property OnlineResource() As String
    Public Property Version() As String
    Public Property Layer() As String
End Class
